<template>
<div class="swiperBox">
  <swiper :options="swiperOption" v-if="showSwiper">
    <swiper-slide v-for="item of swiper" :key="item.id">
      <img :src="item.imgUrl" class="swiperImg" />
    </swiper-slide>
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
</div>
</template>
<script>
export default{
  name: 'homeSwiper',
  props: {
    swiper: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true
      }
    }
  },
  computed: {
    showSwiper () {
      return this.swiper.length
    }
  }
}
</script>
<style lang="scss">
@import '~styleSrc/base';
.swiperBox .swiper-pagination-bullet-active{
  background: $color-primary !important;
}
</style>
<style lang="scss" scoped>
.swiperBox{
  width: 100%;
  height: 0;
  overflow: hidden;
  padding-bottom: 45.7%;
}
.swiperImg{width: 100%;}
</style>
